﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace Panopticon
{
    public class Player : Actor
    {
        
        public Player() :
            base(new Rectangle(200,200,20,50),Game1.Textures["WhiteBox"], Color.DarkGreen)
        {
            isSolid = true;
            isActive = true;
            moveSpeed = 1f;
        }

        public override void Update(GameTime gameTime)
        {
            movement = Walk();
            momentum += Jump();

            foreach (Actor otherActor in Game1.ActorList)
            {
                
            }

            base.Update(gameTime);
            World.relativeVector += currentPosition - lastPosition;
            
        }

        Vector2 Walk()
        {
            Vector2 walkMovement = Vector2.Zero;
            if (Is.keyDown(Keys.Left))
                walkMovement.X -= moveSpeed;
            if (Is.keyDown(Keys.Right))
                walkMovement.X += moveSpeed;
            return walkMovement;
        }

        Vector2 Jump()
        {
            Vector2 jumpMomentum = Vector2.Zero;
            if (Is.keyDown(Keys.Space) && !isFalling)
                jumpMomentum.Y -= 3.5f;
            return jumpMomentum;
        }




    }
}
